
Imports QuickGraph
Imports System.Xml

Namespace Aricie.DNN.Caching.Analysis.Graphs
    Public Class DistributedCachingEdge
        Inherits TaggedEquatableEdge(Of DistributedCachingNode, CacheSequenceTag)

        Public Sub New()
            MyBase.New(New DistributedCachingNode, New DistributedCachingNode, New CacheSequenceTag())
        End Sub

        Public Sub New(ByVal source As DistributedCachingNode, ByVal target As DistributedCachingNode, ByVal tag As CacheSequenceTag)
            MyBase.New(source, target, tag)
        End Sub

        Public Overrides Function ToString() As String
            'Return String.Format("{0} -> {1} ({2})", CacheKeyStatistics.FormatKey(Source.Key), CacheKeyStatistics.FormatKey(Target.Key), Tag.Count)
            Return String.Format("{0} -> {1}({2})", Me.Source.ToString, Me.Target.ToString, Tag.Count)
            'Return Tag.Count.ToString
        End Function

        Public Shared Function Identity(ByVal objEdge As DistributedCachingEdge) As String
            Return objEdge.ToString
        End Function

        Public Shared Function AllEdgesPredicate(ByVal objMatch As DistributedCachingEdge) As Boolean
            Return True
        End Function


        Public Shared Function Factory(ByVal reader As XmlReader) As DistributedCachingEdge
            Return DirectCast(reader.ReadContentAs(GetType(DistributedCachingEdge), Nothing), DistributedCachingEdge)
        End Function
    End Class
End Namespace